<?php
/** 
 * $Source: /cvsroot/pn-commerce/pn-commerce/pntemplates/plugins/function.pncGetStatisticsForOrders.php,v $
 * $Author: pcornelissen $
 * $Revision: 1.2 $
 * $Date: 2003/12/08 12:09:47 $
 *
 * Type: Function
 *
 * Calculates the statistics for the given orders and assignes them to the variable named like
 * assign, default is statistics
 * @param  Orders : Array of orders to process
 * @param   assign  : name of variable to assign the item array to. If assign is not set, we will use 'statistics'
 */
function smarty_function_pncGetStatisticsForOrders($params, &$smarty)
{
    extract($params);
    if( !pnModLoad( 'pncommerce', 'admin' ) )
    {
        return false;
    }

    if ( !pnModAPILoad( 'pncommerce', 'admin' ) )
    {
        return false;
    }

    if( !$assign )
    {
        $assign = 'statistics';
    }
    $statistics = pnModAPIFunc( 'pncommerce', 'admin', 'calculateBasicStats',
                              array( 'Orders' => $Orders ) );
    $smarty->assign( $assign, $statistics );
}
?>
